//
//  IDDError+LocalCache.h
//  ComJia
//
//  Created by Aslan on 17/02/2017.
//  Copyright © 2017 ComJia. All rights reserved.
//

#import "IDDError.h"

typedef NS_ENUM(NSInteger, IDDCacheDomainError) {
    IDDErrorCacheDomainUnknownError, /* 未知错误 */
    IDDErrorCacheDomainSetCacheToNil, /* 缓存对象为空 */
    IDDErrorCacheDomainRemoveItem, /* 删除缓存文件失败 */
    IDDErrorCacheDomainExistingDirectory, /* 与目标文件同名的目录已经存在 */
    IDDErrorCacheDomainFilesystemError, /* 文件系统错误 */
    IDDErrorCacheDomainUncacheableObject, /* 不支持的缓存对象 */
    IDDErrorCacheDomainArchiveFailure, /* 归档对象失败 */
    IDDErrorCacheDomainUnarchiveFailure /* 反归档对象失败 */
};

extern NSString *const IDDErrorCacheDomain;

IDDError *cacheErrorWithCode(NSUInteger, NSError *);
#define cacheErrorWithCode(code, error) [IDDError cacheErrorWithCode:code callstack:[NSThread callStackSymbols] underlyingError:error]

@interface IDDError (LocalCache)

+ (IDDError *)cacheErrorWithCode:(NSUInteger)code callstack:(NSArray *)callstack underlyingError:(NSError *)underlyingError;

@end
